//
//  LianTianLieBiaoTableViewController.swift
//  RoundCatPlay2
//
//  Created by 姜澎 on 2019/10/31.
//  Copyright © 2019 jiangpeng. All rights reserved.
//

import UIKit

class LianTianLieBiaoViewController: UIViewController {
    
    private lazy var topView: LiaoTianLieBiaoTopView = {
        let v = LiaoTianLieBiaoTopView()
        v.backgroundColor = UIColor.white
        return v
    }()
    
    private lazy var lianTianLieBiaoTV :UITableView = {
        let tvc = UITableView()
        tvc.dataSource = self
        tvc.delegate = self
        tvc.separatorStyle = .none
        tvc.backgroundColor = UIColor(red: 246/255, green: 246/255, blue: 246/255, alpha: 1)
        return tvc
    }()
    
//    声音
    private lazy var radioBut: UIButton = {
        let btu = UIButton(type: .custom)
        btu.setBackgroundImage(UIImage(named: "radio"), for: .normal)
        btu.setBackgroundImage(UIImage(named: "sradio"), for: .highlighted)
        return btu
    }()
//    输入框
    private lazy var textContent: UITextField = {
        let t = UITextField()
        t.placeholder = "   请输入内容..."
        t.font = UIFont.systemFont(ofSize: 14)
        t.backgroundColor = UIColor(red: 248.0 / 255.0, green: 248.0 / 255.0, blue: 248.0 / 255.0, alpha: 1.0)
        t.layer.cornerRadius = 7
        t.clearButtonMode = UITextField.ViewMode.whileEditing
        t.tintColor = UIColor.black
        
        return t
    }()
    
    //    表情
    private lazy var phizBut: UIButton = {
        let but = UIButton(type: .custom)
        but.setBackgroundImage(UIImage(named: "phiz"), for: .normal)
        but.setBackgroundImage(UIImage(named: "sphiz"), for: .highlighted)
        return but
    }()
    
    private lazy var addBut: UIButton = {
        let but = UIButton(type: .custom)
        but.setBackgroundImage(UIImage(named: "add"), for: .normal)
        but.setBackgroundImage(UIImage(named: "sadd"), for: .highlighted)
        return but
    }()
    
/*    发送
    private lazy var fsBut: UIButton = {
        let but = UIButton(type: .custom)
        but.backgroundColor = UIColor(red: 83.0 / 255.0, green: 105.0 / 255.0, blue: 237.0 / 255.0, alpha: 1.0)
        but.setTitle("发送", for: .normal)
        but.setTitle("发送", for: .highlighted)
        but.titleLabel?.font = UIFont.systemFont(ofSize: 16)
        but.setTitleColor(.white, for: .normal)
        but.setTitleColor(.white, for: .highlighted)
        but.layer.cornerRadius = 7
        return but
    }()
 */
    
    private lazy var bootomView: UIView = {
        let v = UIView()
        v.backgroundColor = .white
        v.addSubview(radioBut)
        v.addSubview(textContent)
        v.addSubview(phizBut)
        v.addSubview(addBut)
        return v
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = .white
        title = "王者荣耀陪玩小姐姐"
        
        navigationController?.navigationBar.tintColor = .black
        
        self.navigationController?.navigationBar.titleTextAttributes = [
            NSAttributedString.Key.font : UIFont.italicSystemFont(ofSize: 18)
        ]
        
        setUI()
    }
    
}

extension LianTianLieBiaoViewController: UITableViewDelegate,UITableViewDataSource {
    
    func numberOfSections(in tableView: UITableView) -> Int {
        
        return 0
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        
        return 0
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        return UITableViewCell()
        
    }
}


extension LianTianLieBiaoViewController {
    func setUI() {
        
        view.addSubview(topView)
        view.addSubview(lianTianLieBiaoTV)
        view.addSubview(bootomView)
        
        
        setTopView()
        setLianTianLieBiaoTV()
        setBottomView()
        
        setRadioBtuFrame()
        settextContentFrame()
        setphizButFrame()
        setAddButFrame()
        
    }
    
    func setTopView() {
        self.topView.snp.makeConstraints { (make) in
            make.top.equalTo(88)
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.height.equalTo(91)
        }
    }
    
    func setLianTianLieBiaoTV() {
        self.lianTianLieBiaoTV.snp.makeConstraints { (make) in
            make.top.equalTo(topView.snp.bottom)
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.bottom.equalTo(-78)
        }
    }
    
    func setBottomView() {
        self.bootomView.snp.makeConstraints { (make) in
            make.top.equalTo(lianTianLieBiaoTV.snp_bottom)
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.bottom.equalTo(-20)
        }
    }
    
    func setRadioBtuFrame() {
        self.radioBut.snp.makeConstraints { (make) in
            make.top.equalTo(14)
            make.bottom.equalTo(-14)
            make.left.equalTo(15)
            make.width.equalTo(30)
        }
    }
    
    func settextContentFrame() {
        self.textContent.snp.makeConstraints { (make) in
            make.top.equalTo(11)
            make.left.equalTo(radioBut.snp_right).offset(11)
            make.bottom.equalTo(-11)
            make.width.equalTo(250)
        }
    }
    
    func setphizButFrame() {
        self.phizBut.snp.makeConstraints { (make) in
            make.top.equalTo(14)
            make.left.equalTo(textContent.snp.right).offset(11)
            make.bottom.equalTo(-14)
            make.width.equalTo(30)
        }
    }
    
    func setAddButFrame() {
        self.addBut.snp.makeConstraints { (make) in
            make.top.equalTo(14)
            make.left.equalTo(phizBut.snp_right).offset(11)
            make.bottom.equalTo(-14)
            make.width.equalTo(30)
        }
    }
    
    

}
